﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ReportsDefault.aspx.cs" Inherits="cs499.Reports.ReportsDefault" %>
<%@ MasterType VirtualPath="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content runat="server" ID="navbar" ContentPlaceHolderID="NavOptions">
    Filter By Location:<br />
    <asp:DropDownList ID="PlaceDropDownList" runat="server" DataSourceID="PlaceDataSource" DataTextField="PlaceName" DataValueField="Id" AutoPostBack="True" AppendDataBoundItems="True">
        <asp:ListItem Value="-1">All</asp:ListItem>
    </asp:DropDownList>
    <asp:EntityDataSource ID="PlaceDataSource" runat="server" ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EntitySetName="Places" Where="it.Department.Id=@newparameter">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" DefaultValue="-1" Name="newparameter" SessionField="CurrentDepartmentId" />
        </WhereParameters>
    </asp:EntityDataSource>
    <br />
    <br />
    Filter By Faculty:
    <br />
    <asp:DropDownList ID="UserDropDownList" runat="server" DataSourceID="UserDataSource" DataTextField="UserName" DataValueField="Id" AutoPostBack="True" AppendDataBoundItems="True">
        <asp:ListItem Value="-1">All</asp:ListItem>            
    </asp:DropDownList>
    <asp:ObjectDataSource ID="UserDataSource" runat="server" SelectMethod="GetFacultyForDepartment" TypeName="cs499.Database.Faculty">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="-1" Name="departmentid" SessionField="CurrentDepartmentId" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <br />
    <br />
    <asp:LinkButton ID="exportReportbutton" runat="server" OnClick="exportReportbutton_Click">Export Report</asp:LinkButton>
</asp:Content>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        
        <div class="content-wrapper">
            <h3>Schedule Report</h3>
            
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <asp:GridView ID="ScheduleGridView" runat="server" AutoGenerateColumns="False" DataSourceID="ScheduleDataSource">
        <Columns>
            <asp:BoundField DataField="Course" HeaderText="Course" SortExpression="Course" />
            <asp:BoundField DataField="SectionNumber" HeaderText="SectionNumber" SortExpression="SectionNumber" />
            <asp:BoundField DataField="Room" HeaderText="Room" SortExpression="Room" />
            <asp:BoundField DataField="TimeSlot" HeaderText="TimeSlot" SortExpression="TimeSlot" />
            <asp:BoundField DataField="TaughtBy" HeaderText="TaughtBy" SortExpression="TaughtBy" />
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ScheduleDataSource" runat="server" SelectMethod="GetScheduledCourses" TypeName="cs499.Database.Department">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="-1" Name="departmentid" SessionField="CurrentDepartmentId" Type="Int32" />
            <asp:ControlParameter ControlID="NavOptions$PlaceDropDownList" DefaultValue="-1" Name="placeid" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="NavOptions$UserDropDownList" DefaultValue="-1" Name="facultyid" PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
